/**
 * 2017年11月13日
 */
package exp.algorithm.sic.feature;

import java.util.Arrays;

import exp.util.MatrixUtil;

/**
 * @author Alex
 *
 */
public class DenseFeatureVector extends AbstractFeatureVector{
	public float[] data;

	public DenseFeatureVector(float []arr) {
		this.data = arr;
	}
	public static FeatureVector fromFloatArray(float[]arr){
		return new DenseFeatureVector(arr);
	}
	public static FeatureVector fromFloatArray2D(float [][] arr){
		return new DenseFeatureVector(MatrixUtil.flatFloatArray(arr));
	}
	@Override
	public int length() {
		return data.length;
	}
	@Override
	public float getVal(int idx) {
		return data[idx];
	}
	@Override
	public float[] toFloatArray() {
		return data;
	}
	@Override
	public String toString() {
		return Arrays.toString(data);
	}
	
}
